package class1.s2022350143028.service.Impl;

import base.model.UserBaseModel;
import class1.s2022350143028.data.UsersData;
import class1.s2022350143028.model.UserModel;
import class1.s2022350143028.service.ILoginsxyService;

public class LoginsxyServiceImpl implements ILoginsxyService {
//todo 示例登录业务逻辑接口实现类，完成作业时自行扩展

    protected UsersData usersData;

    //todo 重写构造方法，新建实例对象时，获取数据源

    public boolean CheckLogin(UserModel loginUser){
        usersData=new UsersData();
        try{
            UserModel user = usersData.get(loginUser.getUsername());
            if(user!=null){
                return user.getPassword().equals(loginUser.getPassword());
            }else{
                return false;
            }
        }catch (Exception ex){
            return false;
        }
    }

    @Override
    public boolean checkLogin(UserBaseModel userBaseModel) {
        return false;
    }
}
